package xelaticsearch

import (
	"bytes"
	"gitee.com/igolang/pkg/xjson"
)

type MappingItem struct {
	Type     string `json:"type"`
	Index    bool   `json:"index"`
	Store    bool   `json:"store"`
	Analyzer string `json:"analyzer"`
}

func NewMapping(list map[string]MappingItem) *bytes.Buffer {
	m := map[string]interface{}{
		"properties": list,
	}

	b, _ := xjson.Marshal(m)
	return bytes.NewBuffer(b)
}
